using Boo.Lang.Runtime;
using System;
using UnityEngine;

[Serializable]
public class SpecialAttack : MonoBehaviour
{
	public Camera mainCamera;

	public GameObject tap;

	public string current;

	public Color[] colors;

	public object effect;

	[HideInInspector]
	public bool specialEnabled;

	public void Awake()
	{
		mainCamera = Camera.main;
		current = "Attack" + PlayerPrefs.GetInt("ChipState");
		effect = Resources.Load(current);
		GameObject gameObject = GameObject.Find("SpecialEnergy");
		if (!RuntimeServices.EqualityOperator(effect, null))
		{
			specialEnabled = true;
			((score)UnityEngine.Object.FindObjectOfType(typeof(score))).specialEnabled = specialEnabled;
			gameObject.transform.Find("ProgressBar").GetComponent<GUITexture>().color = colors[PlayerPrefs.GetInt("ChipState") - 1];
		}
		else
		{
			UnityEngine.Object.Destroy(gameObject);
		}
	}

	public void Activate()
	{
		if (specialEnabled && !StateManager.specialAttack)
		{
			GetComponent<AudioSource>().Play();
			object obj = effect;
			if (!(obj is UnityEngine.Object))
			{
				obj = RuntimeServices.Coerce(obj, typeof(UnityEngine.Object));
			}
			UnityEngine.Object.Instantiate((UnityEngine.Object)obj, transform.position, Quaternion.identity);
		}
	}

	public void Disable()
	{
		gameObject.SetActive(false);
	}

	public void Main()
	{
	}
}
